import JDBCunit.Jdbcs;

import java.sql.*;
import java.util.Scanner;

public class JdbcTest04 {
    public static void main(String[] args) {
        Connection cc = null;
        Statement stm = null;
        ResultSet rs = null;
        try {

            cc = Jdbcs.jC();
            stm = cc.createStatement();
            Scanner sc = new Scanner(System.in);
            String temp = sc.nextLine();
            String sql = "select sal from emp order by sal "+ temp+"";
            rs = stm.executeQuery(sql);
            while (rs.next()) {
                System.out.println(rs.getInt("sal"));
            }


        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } finally {

                try {
                   Jdbcs.jClose(rs,stm,cc);
                } catch (SQLException e) {
                    e.printStackTrace();
                }
        }
    }
}
